package com.boguan.web.controller.common;

import com.boguan.common.core.redis.RedisCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 验证码校验
 */
@Component
public class CaptchaVerify {

    @Autowired
    private RedisCache redisCache;


    public boolean verify(String code, String verify) {
        String verifyCode = redisCache.getCacheObject(verify);
        if (code.equals(verifyCode)) {
            redisCache.deleteObject(verify);
            return true;
        }
        return false;
    }


}
